<%--
  Created by IntelliJ IDEA.
  User: hiugiak
  Date: 2018/12/8
  Time: 9:06 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <jsp:include page="../../includes/framework-headers.jsp"/>
    <jsp:include page="../../includes/framework-navbar-student.jsp">
        <jsp:param name="navSelection" value="1-1"/>
    </jsp:include>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/components/form-file.almost-flat.min.css"/>
    <script src="${pageContext.request.contextPath}/js/student/dialog_doc_submission.js"></script>

    <title>毕业设计指导网站 - 我的任务</title>
</head>
<body>
<div class="gpg-middle">
    <div class="uk-container uk-container-center">
        <div class="uk-grid" data-uk-grid-margin>
            <jsp:include page="../../includes/framework-nav-panel-student.jsp">
                <jsp:param name="navSelection" value="1-1"/>
            </jsp:include>
            <div class="uk-width-medium-3-4">
                <article class="uk-article">
                    <div class=""></div>
                    <table class="gpg-table uk-table">
                        <thead>
                        <tr>
                            <th></th>
                            <th>任务</th>
                            <th>开始时间</th>
                            <th>结束时间</th>
                            <th>已提交文件</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="phase" items="${phaseList}" varStatus="loop">
                            <tr data-phase-id="${phase.plan.phaseId}">
                                <td>${loop.index + 1}</td>
                                <td>${phase.plan.name}</td>
                                <td><fmt:formatDate value="${phase.plan.startDate}" pattern="yyyy-MM-dd"/></td>
                                <td><fmt:formatDate value="${phase.plan.endDate}" pattern="yyyy-MM-dd"/></td>
                                <c:choose>
                                    <c:when test="${phase.plan.requireDocument == true}">
                                        <c:choose>
                                            <c:when test="${phase.documentInfo == null}">
                                                <td class="uk-text-muted">未提交</td>
                                            </c:when>
                                            <c:otherwise>
                                                <td>
                                                    <a class="uk-text-truncate" href="${pageContext.request.contextPath}/studentDoc/download/${phase.documentInfo.fileId}">${phase.documentInfo.fileName}</a>
                                                </td>
                                            </c:otherwise>
                                        </c:choose>
                                        <td>
                                            <button class="uk-button uk-button-small uk-button-success btn-submit-doc">提交文件</button>
                                        </td>
                                    </c:when>
                                    <c:otherwise>
                                        <td colspan="2" class="uk-text-muted">无要求</td>
                                    </c:otherwise>
                                </c:choose>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </article>

                <div id="dialog_doc_submission" class="uk-modal">
                    <div class="uk-modal-dialog">
                        <button type="button" class="uk-modal-close uk-close"></button>
                        <div class="uk-modal-header">
                            <h2>提交文档</h2>
                        </div>
                        <div class="uk-overflow-container">
                            <form id="form_submit_doc">
                                <%--<input type="text" value="" hidden>--%>
                                <div class="uk-form-file">
                                    <button class="uk-button uk-button-primary"><i class="uk-icon-folder-open"></i> 选择文件</button>
                                    <input type="file" id="input_file" name="file">
                                </div>
                                <div id="file_info" style="padding: 8px 4px;">
                                    <%--文件名 <em class="uk-text-muted">(1KB)</em>--%>
                                </div>
                            </form>
                        </div>
                        <div class="uk-modal-footer uk-text-right">
                            <button type="button" class="uk-button uk-modal-close">取消</button>
                            <button type="button" class="uk-button uk-button-primary" id="btn_submit_doc">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
